//
//  HeadTableViewCell.m
//  hello
//
//  Created by 查传申 on 15/12/10.
//  Copyright © 2015年 查传申. All rights reserved.
//

#import "HeadTableViewCell.h"

@implementation HeadTableViewCell
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.imageHead = [[UIImageView alloc]initWithFrame:CGRectZero];
        _imageHead.backgroundColor = [UIColor greenColor];
        
        self.label_name = [[UILabel alloc]initWithFrame:CGRectZero];
        _label_name.backgroundColor = [UIColor redColor];
        
        self.label_text = [[UILabel alloc]initWithFrame:CGRectZero];
        _label_text.backgroundColor = [UIColor blueColor];
        
        self.label_type = [[UILabel alloc]initWithFrame:CGRectZero];
        _label_type.backgroundColor = [UIColor blueColor];
        _label_type.textAlignment = NSTextAlignmentRight;
        
        self.label_material = [[UILabel alloc]initWithFrame:CGRectZero];
        _label_material.backgroundColor = [UIColor brownColor];
        _label_material.textAlignment = NSTextAlignmentRight;
        [self.contentView addSubview:_label_material];
        [self.contentView addSubview:_label_name];
        [self.contentView addSubview:_label_text];
        [self.contentView addSubview:_label_type];
        [self.contentView addSubview:_imageHead];
    }
    return self;
}
-(void)layoutSubviews{
    [super layoutSubviews];
    _imageHead.frame = CGRectMake(0, 2, self.contentView.frame.size.height-4,  self.contentView.frame.size.height-4);
    _label_name.frame = CGRectMake(_imageHead.frame.origin.x + _imageHead.frame.size.width + 5, _imageHead.frame.origin.y, self.contentView.frame.size.width/3, _imageHead.frame.size.height/2);
    _label_text.frame = CGRectMake(_label_name.frame.origin.x, _label_name.frame.origin.y + _label_name.frame.size.height, self.contentView.frame.size.width*2/3, _label_name.frame.size.height);
    _label_type.frame = CGRectMake( self.contentView.frame.size.width - 60, _label_name.frame.origin.y, 60, _label_name.frame.size.height);
    _label_material.frame = CGRectMake(_label_text.frame.size.width + _label_text.frame.origin.x +5, _label_text.frame.origin.y, self.contentView.frame.size.width -(_label_text.frame.size.width + _label_text.frame.origin.x +5), _label_type.frame.size.height);
    
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
